package com.gps.funnymath.domains;


import java.util.ArrayList;
import java.util.Random;

import com.gps.funnymath.concreteItems.ConcreteVerb;


public class VerbDomain implements Domain{

	static Random random = new Random();
	
	ArrayList<ConcreteVerb> verbs; // all verbs in domain
	
	String label;

	public VerbDomain(String label){
		
		verbs = new ArrayList<ConcreteVerb>();
		
		this.label = label;
	}
	
	public boolean add(ConcreteVerb verb){
		return verbs.add(verb);
	}
	
	public boolean remove(ConcreteVerb verb){
		return verbs.remove(verb);
	}
	
	public ConcreteVerb getRandom(){
		int index = random.nextInt(verbs.size());
		return verbs.get(index);
	}

	@Override
	public boolean contains(Object object) {
		
		if(object instanceof ConcreteVerb){
			
			for (ConcreteVerb verb : verbs){
			    if (verb.equals((ConcreteVerb)object))
			    	return true;
			}
			
		}
		
		return false;
	}
}
